<!DOCTYPE html>
<html>
<head>
    <% include("/common/title.html"){} %>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="col-sm-12">
        <div class="example">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>查询条件</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                    隐藏
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="row form-horizontal">
                                <div class="col-sm-10">
                                    <div>
                                        <label class="col-sm-2 control-label">状态</label>
                                        <div class="col-sm-2">
                                            <select class="form-control" name="status" id="status">
                                                <option value="">请选择</option>
                                                <option value="0">成功</option>
                                                <option value="1">失败</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <p>
                                        <button class="btn  btn-primary" onclick="searchTable()"
                                                type="submit"><strong>查询</strong>
                                        </button>
                                        <button class="btn  btn-white"
                                                type="submit" onclick="clearSearchBtn()"><strong>清空查询条件</strong>
                                        </button>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="ibox-content">
                <table id="tablepager" data-mobile-responsive="true">
                </table>
            </div>
        </div>
    </div>
</div>
<div id="editer_form_div" style="display: none;">
    <form class="form-horizontal" id="myForm">
        <input type="hidden" name="id" id="id">
        <div class="col-md-12">
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">服务
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_company_id" name="f_company_id" class="form-control" placeholder="景区id">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">日志类型
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_service_type" name="f_service_type" class="form-control"
                           placeholder="日志类型">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">状态
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_status" name="f_status" class="form-control" placeholder="状态">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请求参数
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_request" name="f_request" class="form-control" placeholder="请求参数">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">响应信息
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_response" name="f_response" class="form-control" placeholder="响应信息">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">错误信息
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_error_msg" name="f_error_msg" class="form-control" placeholder="错误信息">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">耗时（ms）
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_duration" name="f_duration" class="form-control" placeholder="耗时（ms）">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">方法名称
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_method_path" name="f_method_path" class="form-control" placeholder="方法名称">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">ip
                    :</label>
                <div class="col-sm-6">
                    <input type="text" id="f_ip" name="f_ip" class="form-control" placeholder="ip">
                </div>
            </div>
        </div>
    </form>
</div>
<% include("/common/commonjs.html"){} %>
<script type="text/javascript">
    $(function () {
        loadData();
        validateForm();

    });

    function loadData() {
        var url = "${ctxPath }/companyCallLog/page";
        $('#tablepager').bootstrapTable({
            url: url,
            dataType: "json",
            pagination: true, //分页
            singleSelect: true,//只能选择一行
            clickToSelect: true,
            search: false, //显示搜索框
            sidePagination: "server", //服务端处理分
            pageNumber: 1,
            pageSize: 10,
            pageList: [10, 20, 50, 100],
            queryParams: function (params) {
                var par = {
                    "f_company_id": $("#searchf_company_id").val(),
                    "f_service_type": $("#searchf_service_type").val(),
                    "f_status": $("#searchf_status").val(),
                    "f_duration": $("#searchf_duration").val(),
                    "f_ip": $("#searchf_ip").val(),
                    "f_status": $("#status").val()
                };
                var p = $.extend({}, params, par);
                return p;
            },
            showColumns: true,
            showRefresh: true,
            showToggle: true,
            toolbar: "#tableToolbar",
            columns: [  {
                field: "f_service_type_show",
                title: "日志类型",
                width: 100
            }, {
                field: "f_create_time",
                title: "时间",
                width: 100
            }, {
                field: "f_status_show",
                title: "状态",
                formatter: function (value, row) {
                    if (row.f_status == 1) {
                        return value + "(" + row.f_error_msg + ")";
                    } else {
                        return value;
                    }
                },
                width: 100
            }, {
                field: "f_duration",
                title: "耗时（ms）",
                width: 80
            }, {
                field: "f_request",
                title: "请求信息",
                formatter: function (value, row) {
                    return "<pre>" + JSON.stringify(JSON.parse(value), null, 2) + "</pre>";
                }
            },{
                field: "f_response",
                title: "响应信息",
                formatter: function (value, row) {
                        return "<pre>" + JSON.stringify(JSON.parse(value), null, 2) + "</pre>";
                }
            }
            ]
        });
    }

    function searchTable() {
        $('#tablepager').bootstrapTable("refresh");
    }



    function clearSearchBtn() {
        $("#searchf_company_id").val("");
        $("#searchf_service_type").val("");
        $("#searchf_status").val("");
        $("#searchf_duration").val("");
        $("#searchf_ip").val("");
    }
</script>
</body>
</html>

</body>




